package leetcode_901_1000;

import java.util.Arrays;

public class LeeCode_940 {
    public static void main(String[] args) {
        System.out.println(distinctSubseqII("aaa"));
    }
    private static int distinctSubseqII(String s) {
        long mod = (long) (1e9 + 7);
        long[] f = new long[26];
        int n = s.length();
        for (int i = 0; i < n; i++) {
            f[s.charAt(i) - 'a'] = (1 + Arrays.stream(f).sum()) % mod;
        }
        return (int) (Arrays.stream(f).sum() % mod);
    }
}